package com.datang.pet.api.messageController;/*
 * @auther 顶风少年
 * @mail dfsn19970313@foxmail.com
 * @date 2019-06-18 18:38
 * @notify
 * @version 1.0
 */

import com.datang.pet.common.response.Result;
import com.datang.pet.common.utils.MD5;
import com.datang.pet.common.utils.StringUtils;
import com.datang.pet.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class GetCommentMessageListController {
    @Autowired
    private MessageService messageService;

    @GetMapping("/getCommentMessageList")
    public Result getCommentMessageList(String userId, Date time) throws Exception {
        //UserId是否为空
        if (!StringUtils.isNUll(userId)) {
            throw new Exception("用户id为空");
        }
        try {
            userId = (MD5.decryptData(userId));
        } catch (Exception e) {
            throw new Exception("userId解密出错！");
        }
        return Result.ok(messageService.getCommentMessageList(userId,time));
    }
}
